{% extends 'base.html' %}


{% block title %}职员管理{% endblock %}
{% block header %}职员管理{% endblock %}
{% block css %}{% endblock %}
{% block content %}
{#    #}
    <div class="row">
        <div class="col-lg-12">
            <div class="row">
                <div class="col-lg-8">

                    {% for i in d_list %}
                        <a class="btn btn-default" href="/person?dy={{ i.id }}">{{ i.name }}</a>
                    {% endfor %}

                </div>
                <form role="form" class="col-lg-3" method="get" action="/person">
                    <div class="form-group input-group">
                        <input type="text" name="person_username" class="form-control" placeholder="输入要搜索的雇员的名字"
                               value="{{ person_username | default("", boolean=True) }}">
                        <span class="input-group-btn">
                        <button class="btn btn-default" type="submit">
                            <i class="fa fa-search"></i>
                        </button>
                    </span>
                    </div>
                </form>
                <div class="col-lg-1">
                    <a class="btn btn-default" href="/add_person">添加</a>
                </div>
            </div>
            <div class="row">
                <table class="table">
                    <thead>
                    <tr>
                        <th>职员用户名</th>
                        <th>职员部门</th>
                        <th>职员职位</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    {% for i in my_paginate.items %}
                        <tr>
                            <td>{{ i.username }}</td>
                            <td>{{ i.person_position_map.position_department_map.name }}</td>
                            <td>{{ i.person_position_map.name }}</td>
                            <td>
                                <a class="btn btn-default" href="/detail_person/{{ i.id }}">详情</a>
                                <a class="btn btn-default" href="/edit_person/{{ i.id }}">编辑</a>
                                <a class="btn btn-default" href="/delete_person/{{ i.id }}">删除</a>
                            </td>
                        </tr>
                    {% endfor %}

                    </tbody>
                    <tfoot>
                    <tr>
                        <td colspan="4">
                            <ul class="pagination">
                                {% for i in page_range %}
                                    {% if i == my_paginate.page %}
                                        <li class="active"><a href="/person?page_now={{ i }}&person_username={{ person_username }}&dy={{ department_type }}">{{ i }}</a></li>
                                    {% else %}
                                        <li><a href="/person?page_now={{ i }}&person_username={{ person_username }}&dy={{ department_type }}">{{ i }}</a></li>
                                    {% endif %}
                                {% endfor %}
                            </ul>
                        </td>
                    </tr>
                    </tfoot>
                </table>
            </div>
        </div>
        <!-- /.col-lg-12 -->
    </div>
{% endblock %}
{% block  script %} {% endblock %}